import { BasicColumn } from '/@/components/Table';
import { FormSchema } from '/@/components/Table';
import { rules } from '/@/utils/helper/validator';
import { render } from '/@/utils/common/renderUtils';
import { getWeekMonthQuarterYear } from '/@/utils';
//列表数据
export const columns: BasicColumn[] = [
	{
		title: '车辆的VIN',
		align: 'center',
		dataIndex: 'vin',
	},
	{
		title: '告警规则id',
		align: 'center',
		dataIndex: 'warnId',
	},
	{
		title: '告警原因',
		align: 'center',
		dataIndex: 'warnCnName',
		slots: { customRender: 'warnCnName_dictText' },
	},
	{
		title: '告警类型',
		align: 'center',
		dataIndex: 'warnType_dictText',
	},
	{
		title: '所属运营商',
		align: 'center',
		dataIndex: 'operatorid_dictText',
	},
	{
		title: '告警所属充电站',
		align: 'center',
		dataIndex: 'warnStation_dictText',
	},
	{
		title: '告警所属充电桩',
		align: 'center',
		dataIndex: 'warnStake_dictText',
	},
	{
		title: '告警依据',
		align: 'center',
		dataIndex: 'warnDesc',
	},
	{
		title: '告警时关键数值',
		align: 'center',
		dataIndex: 'warnValue',
	},
	{
		title: '告警级别',
		align: 'center',
		dataIndex: 'warnLevel',
	},
	{
		title: '等级',
		align: 'center',
		dataIndex: 'level_dictText',
	},
	{
		title: '告警相关曲线id',
		align: 'center',
		dataIndex: 'warnCurveId',
	},
	{
		title: '告警相关曲线数据',
		align: 'center',
		dataIndex: 'warnCurve',
	},
	{
		title: '创建时间 ',
		align: 'center',
		dataIndex: 'createTime',
	},
];
//查询数据
export const searchFormSchema: FormSchema[] = [
	{
		label: '车辆的VIN',
		field: 'vin',
		component: 'JInput',
		//colProps: {span: 6},
	},
	{
		label: '告警原因',
		field: 'warnCnName',
		component: 'Select',
		slot: 'warnCnNameSlot',
		//colProps: {span: 6},
	},
	{
		label: '告警类型',
		field: 'warnType',
		component: 'JDictSelectTag',
		componentProps: {
			dictCode: 'gjlx',
		},
		//colProps: {span: 6},
	},
	{
		label: '所属运营商',
		field: 'operatorid',
		component: 'Select',
		slot: 'operatorIdSlot',
	},
	{
		label: '所属充电站',
		field: 'warnStation',
		component: 'Select',
		slot: 'stationIdSlot',
	},

	// {
	//   label: "告警级别",
	//   field: 'warnLevel',
	//   component: 'JDictSelectTag',
	//   componentProps: {
	//     dictCode: 'stakestatus',
	//   },
	//   //colProps: {span: 6},
	// },
	{
		label: '等级',
		field: 'level',
		component: 'JDictSelectTag',
		componentProps: {
			dictCode: 'riskLevel',
		},
		//colProps: {span: 6},
	},
];
//表单数据
export const formSchema: FormSchema[] = [
	{
		label: '车辆的vin',
		field: 'vin',
		component: 'Input',
	},
	{
		label: '告警规则id',
		field: 'warnId',
		component: 'InputNumber',
	},
	{
		label: '告警原因',
		field: 'warnCnName',
		component: 'Input',
	},
	{
		label: '告警类型',
		field: 'warnType',
		component: 'InputNumber',
	},
	{
		label: '告警所属充电站',
		field: 'warnStation',
		component: 'Input',
	},
	{
		label: '告警所属充电桩',
		field: 'warnStake_dictText',
		component: 'InputNumber',
	},
	{
		label: '告警依据',
		field: 'warnDesc',
		component: 'Input',
	},
	{
		label: '告警时关键数值',
		field: 'warnValue',
		component: 'Input',
	},
	{
		label: '告警级别',
		field: 'warnLevel',
		component: 'JDictSelectTag',
		componentProps: {
			dictCode: '',
		},
	},
	{
		label: '等级（高中低）',
		field: 'level',
		component: 'JDictSelectTag',
		componentProps: {
			dictCode: 'gjjb',
		},
	},
	{
		label: '告警相关曲线id',
		field: 'warnCurveId',
		component: 'Input',
	},
	{
		label: '告警曲线数据',
		field: 'warnCurve',
		component: 'InputTextArea',
	},
	{
		label: '所属运营商',
		field: 'operatorid',
		component: 'Input',
	},
	// TODO 主键隐藏字段，目前写死为ID
	{
		label: '',
		field: 'id',
		component: 'Input',
		show: false,
	},
];

// 高级查询数据
export const superQuerySchema = {
	vin: { title: '车辆的vin', order: 0, view: 'text', type: 'string' },
	warnId: { title: '告警规则id', order: 1, view: 'number', type: 'number' },
	warnCnName: { title: '告警原因', order: 2, view: 'text', type: 'string' },
	warnType: { title: '告警类型 1:充电过程告警 2:大数据告警', order: 3, view: 'number', type: 'number' },
	warnStation: { title: '告警所属充电站', order: 4, view: 'link_table', type: 'string' },
	warnStakeId: { title: '告警所属充电桩', order: 5, view: 'number', type: 'number' },
	warnDesc: { title: '告警依据', order: 6, view: 'text', type: 'string' },
	warnValue: { title: '告警时关键数值', order: 7, view: 'text', type: 'string' },
	warnLevel: { title: '告警级别', order: 8, view: 'number', type: 'number', dictCode: '' },
	level: { title: '等级（高中低）', order: 9, view: 'number', type: 'number', dictCode: 'gjjb' },
	warnCurveId: { title: '告警相关曲线id', order: 10, view: 'text', type: 'string' },
	warnCurve: { title: '告警曲线数据', order: 11, view: 'textarea', type: 'string' },
	operatorid: { title: '所属运营商', order: 12, view: 'text', type: 'string' },
};

/**
 * 流程表单调用这个方法获取formSchema
 * @param param
 */
export function getBpmFormSchema(_formData): FormSchema[] {
	// 默认和原始表单保持一致 如果流程中配置了权限数据，这里需要单独处理formSchema
	return formSchema;
}
